/*
 * Created on 10.10.2006 by leck
 *
 */
package de.devisnik.shifting.eidle;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import de.devisnik.eidle.picture.SlideShowPreferences;
import de.devisnik.shifting.ShiftingActivator;

public class ShiftingPreferencePage extends FieldEditorPreferencePage
		implements IWorkbenchPreferencePage {

	public ShiftingPreferencePage() {
		super("Shifting", GRID);
		setPreferenceStore(ShiftingActivator.getDefault().getPreferenceStore());
	}

	// @Override
	protected void createFieldEditors() {
		final BooleanFieldEditor enabledEditor = new BooleanFieldEditor(
				ShiftingPreferences.KEY_USE_SCREENSHOT, "use screenshot",
				getFieldEditorParent());
		addField(enabledEditor);
		final DirectoryFieldEditor globalImagePathEditor = new DirectoryFieldEditor(
				SlideShowPreferences.KEY_GLOBAL_IMAGE_PATH, "Image directory",
				getFieldEditorParent());
		addField(globalImagePathEditor);
		final IntegerFieldEditor gridXEditor = new IntegerFieldEditor(
				ShiftingPreferences.KEY_GRID_X, "x grid ",
				getFieldEditorParent());
		gridXEditor.setValidRange(2, 32);
		addField(gridXEditor);
		final IntegerFieldEditor gridYEditor = new IntegerFieldEditor(
				ShiftingPreferences.KEY_GRID_Y, "y grid ",
				getFieldEditorParent());
		gridYEditor.setValidRange(2, 24);
		addField(gridYEditor);
		final IntegerFieldEditor thinkTimeEditor = new IntegerFieldEditor(
				ShiftingPreferences.KEY_THINKING_TIME,
				"Time between moves (in ms)", getFieldEditorParent());
		thinkTimeEditor.setValidRange(1, 1000);
		addField(thinkTimeEditor);
		final IntegerFieldEditor shiftingDelayEditor = new IntegerFieldEditor(
				ShiftingPreferences.KEY_SHIFTING_DELAY,
				"Sliding delay (in ms)", getFieldEditorParent());
		shiftingDelayEditor.setValidRange(1, 100);
		addField(shiftingDelayEditor);
		final IntegerFieldEditor showResultEditor = new IntegerFieldEditor(
				ShiftingPreferences.KEY_SHOW_RESULT_TIME,
				"Show finished puzzle (in ms)", getFieldEditorParent());
		showResultEditor.setValidRange(1, Integer.MAX_VALUE);
		addField(showResultEditor);
		final IntegerFieldEditor scrambleCountEditor = new IntegerFieldEditor(
				ShiftingPreferences.KEY_SCRAMBLE_COUNT, "Scrambling moves",
				getFieldEditorParent());
		showResultEditor.setValidRange(1, Integer.MAX_VALUE);
		addField(scrambleCountEditor);
	}

	public void init(final IWorkbench workbench) {
	}

}
